<template>
  <view>
    <view class="textBox">
      <view class="text1"> {{ title }} </view>
      <view class="text2"> 请参与人准时参加该活动之类的文字信息！ </view>
      <view class="text3" v-if="showOrder" @click="gotoMyOrder()">
        前去查看 我的订单 >
      </view>
    </view>
    <view class="qrcodeBox">
      <view class="qrcodeText">
        <view class="qrcodeText1"> 门票编码 </view>
        <view class="qrcodeText2"> {{ pagesData.orderTradeId }} </view>
      </view>
      <view class="qrcodeImg">
        <view class="qrcodeImg1">
          <image :src="pagesData.qrCodeUrl" mode="aspectFill"></image>
        </view>
        <view class="qrcodeImg2">
          <image src="/static/hotspot/xuxian@2x.png" mode="aspectFill"></image>
        </view>
        <view class="qrcodeImg3">
          <image
            src="/static/hotspot/tiaoxingma@2x.png"
            mode="aspectFill"
          ></image>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import commonMixin from "@/mixin/commonMinxin";

export default {
  mixins: [commonMixin],
  data() {
    return {
      title: "购买成功！",
      title1: "待使用",
      showOrder: true,
      orderNo: "",
      pagesData: {},
    };
  },
  onLoad(options) {
    this.orderNo = options.orderNo;
    this.getData();
  },
  methods: {
    getData() {
      uni.app.post(
        "/activity/order/codeDetails",
        {
          orderNo: this.orderNo,
        },
        "",
        "",
        (res) => {
          if (res.code == 2000) {
            this.pagesData = res.data;
          }
        },
      );
    },
    gotoMyOrder() {
      switch (uni.getSystemInfoSync().platform) {
        case "android":
          let ddd = {
            hideNavBar: "0",
            hideTotalNavBar: "0",
            hideBottomSafeBar: "0",
            navtitle: "我的订单",
            url: "http://192.168.101.147:8080/#/pages/hotspot/myOrder",
          };
          let d = JSON.stringify(ddd);
          console.log(d, "都是对的");
          window.AndroidBridge.pushNewWebVC(d);
          console.log("运行Android上");
          break;
        case "ios":
          window.webkit.messageHandlers.pushNewWebVC.postMessage({
            hideNavBar: "0",
            hideTotalNavBar: "0",
            hideBottomSafeBar: "0",
            navtitle: "我的订单",
            url: "http://192.168.101.147:8080/#/pages/hotspot/myOrder",
          });
          break;
        default:
          console.log("运行在开发者工具上");
          break;
      }
    },
  },
};
</script>

<style lang="scss" scoped>
page {
  background-color: #f8f8f8;
}

.textBox {
  margin-top: 112rpx;

  .text1 {
    font-weight: bold;
    font-size: 32rpx;
    color: #303030;
    text-align: center;
  }

  .text2 {
    font-weight: 400;
    font-size: 24rpx;
    color: #303030;
    text-align: center;
    margin-top: 16rpx;
  }

  .text3 {
    font-weight: 400;
    font-size: 24rpx;
    color: #c69c6d;
    text-align: center;
  }
}

.qrcodeBox {
  margin: 64rpx 28rpx 0;
  background-image: url("/static/hotspot/piao@2x.png");
  background-size: 100% 100%;
  // height: 505.75rpx;
  padding: 32rpx 32rpx 0;

  .qrcodeText {
    .qrcodeText1 {
      font-weight: bold;
      font-size: 28rpx;
      color: #303030;
    }

    .qrcodeText2 {
      font-weight: bold;
      font-size: 32rpx;
      color: #303030;
    }
  }

  .qrcodeImg {
    display: flex;
    margin-top: 12rpx;
    // background-color: red;

    .qrcodeImg1 image {
      margin: 44rpx 0 0 98rpx;
      width: 300rpx;
      height: 300rpx;
    }

    .qrcodeImg2 image {
      width: 5rpx;
      height: 278rpx;
      margin: 64rpx;
    }

    .qrcodeImg3 image {
      width: 43.81rpx;
      height: 222.57rpx;
      margin: 96rpx 0 0 0;
    }
  }
}
</style>
